<template>
  <div>
    <div
      v-for="(item, index) in conditions"
      :key="index"
      style="border:solid 1px #cccccc;margin-bottom:5px;padding:5px"
    >
      <el-button
        @click="delcondition(conditions, index)"
        type="text"
        size="small"
        >移除</el-button
      >
      <br>
      <el-select size="mini" v-model="item.conditionId" placeholder="选择条件选择器">
        <el-option :label="item.name" :value="item.id" v-for="item in conditionSelectors" :key='item.id'> </el-option>
      </el-select>
      
      <el-input
        size="mini"
        v-model="item.parameter"
        placeholder="参数"
      ></el-input>
      <el-input
        size="mini"
        v-model="item.description"
        placeholder="描述"
      ></el-input>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    conditions: {
      type: Array,
      default: function() {
        return [];
      }
    }
  },
  data(){
      return {
          conditionSelectors:[]
      }
  },
  mounted(){
      this.loadConditionSelectors()
  },
  methods:{
      loadConditionSelectors(){
          this.$store.dispatch('workflow/getAllconditions').then(res=>{
              console.log(res)
              this.conditionSelectors = res;
          })
      },
      delcondition(conditions,index)
      {
          conditions.splice(index,1)
      }
  }
};
</script>

<style></style>
